Slide 18

Expression Tree Definition

Let's build a tree from an expression, step by step.

Source Expression

(3 + 4) * 5

The Rules

OP

Internal Nodes are Operators

Nodes with children (like +, *, /) represent operations.

val

Leaf Nodes are Operands

Nodes without children represent values (numbers or variables).

Step 0 of 3